﻿<%@ Page Title="" Language="C#" MasterPageFile="~/PortalParts/Portal.Master" AutoEventWireup="true" CodeBehind="MessageBoard.aspx.cs" Inherits="ZHDJ.Web.Portal.MessageBoard" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
	<style>
		.mycontactinfo .x-form-text {
			padding: 19px 10px;
		}
		.mycontactinfo .x-form-trigger {
			margin-top: 8px;
		}
		.mybtn {
			width: 80px;
			height: 40px;
			line-height: 40px;
		}
	</style>
    <script>
        String.isNullOrEmpty = function (value) {
            if (value == null || value == "")
                return true;
            else
                return false;
        }

        $(function () {
            $("#ctl00_ContentPlaceHolder1_Form1_sdfsdf_btnSave").click(function () {
                var userName = $("#ctl00_ContentPlaceHolder1_Form1_sdfsdf_txtName-inputEl").val();
                var mobileNo = $("#ctl00_ContentPlaceHolder1_Form1_sdfsdf_txtMobileNo-inputEl").val();
                var branch = $("#ctl00_ContentPlaceHolder1_Form1_sdfsdf_ppBranch-inputEl").val();
                var suggestion = $("#ctl00_ContentPlaceHolder1_Form1_sdfsdf_txtSuggestion-inputEl").val();

                if (String.isNullOrEmpty(userName)) {
                    alert("请输入姓名！");
                    return false;
                }

                if (String.isNullOrEmpty(mobileNo)) {
                    alert("请输入联系方式！");
                    return false;
                }
                else {
                    if (!(/^1[3|4|5|7|8]\d{9}$/.test(mobileNo))) {
                        alert("请输入正确的手机号码格式！");
                        return false;
                    }
                }

                //if (String.isNullOrEmpty(branch)) {
                //    alert("请选择所属支部！");
                //    return false;
                //}

                if (String.isNullOrEmpty(suggestion)) {
                    alert("请填写意见或建议！");
                    return false;
                }

                return true;
            });
        });
    </script>





    <script src="../Resource/js/default/jquery.tmpl.min.js"></script>
    <script src="../Resource/js/knockout/knockout-3.4.0.js"></script>
    <script src="../Resource/js/jquery/jquery.pagination.js"></script>
    <script>
        var pageSize = 10, isBind = false;
        var initImgSize = function () {
            $('.nailthumb-container').each(function (i, n) {
                $(n).nailthumb({ width: 122, height: 145, method: 'resize', fitDirection: 'center center' });
            });

        }
        var paginationPara = {
            num_edge_entries: 1, //边缘页数
            num_display_entries: 4, //主体页数
            callback: pageselectCallback,
            items_per_page: pageSize, //每页显示1项
            prev_text: "上一页",
            next_text: "下一页",
            link_to: "javascript:void(0);"
        }
        var ViewModel = {
            qdate: ko.observableArray(),
            loadContacts: function (pageIndex) {
                $.get("MessageBoard.aspx", {
                    PageIndex: pageIndex,
                    PageSize: pageSize,
                    r: (new Date()).getTime()
                },
                function (data) {
                    var ss = eval("(" + data + ")");

                    ViewModel.qdate(eval("(" + data + ")"));
                });
            }
        }

        function initPage() {
            $.get("MessageBoard.aspx", { DataCount: 1, r: (new Date()).getTime() },
                function (data) {
                    var totalCount = parseInt(data);
                    if (totalCount == 0) {
                        $("#trnonedata").show();

                    }
                    $("#pagination").pagination(totalCount, paginationPara);
                });
        }
        function pageselectCallback(pageIndex, jq) {
            ViewModel.loadContacts(pageIndex);
            if (!isBind) {
                ko.applyBindings(ViewModel);
                isBind = true;
            }

        }
		$(function () {
			initPage();			
        });


    </script>

    <script id="myTemplate" type="text/x-jquery-tmpl">
        <tr style="text-align: center;">
            <td><a href="javascript:void(0)" title="${Message}">${Message}</a></td>
            <td><a href="javascript:void(0)" title="${HandleContent}">${HandleContent}</a></td>
            <td><span>${CreateTime2}</span></td>
        </tr>
    </script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="hdCategory" runat="server" />
    <div class="ny_box">
        <div style="width:100%;background:#f2f2f2;">
            <span style="display: inline-block;font-size:16px;font-weight:bold;background:#fff;height: 38px;line-height: 38px;color: #171717;padding:0 20px;border-top: solid 2px #ea0900;">历史留言</span>
        </div>

        <table class="tabar_zzz" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td style="width:30%;font-weight:bold;font-size:16px;text-align: center;">留言内容</td>
                <td style="width:40%;font-weight:bold;font-size:16px;text-align: center;">回复内容</td>
                <td style="width:30%;font-weight:bold;font-size:16px;text-align: center;">留言时间</td>
            </tr>

            <!-- ko template: { name: 'myTemplate', foreach: qdate} -->
            <!-- /ko -->
            <tr style="display: none" id="trnonedata" class="tr_a">
                <td class="td2" style="text-align: center;font-weight:bold;font-size:16px;color: #171717;" colspan="3">暂无数据……
                </td>
            </tr>
        </table>
    </div>
    <div class="pagination" style="margin-bottom: 40px;">
        <div id="pagination">
        </div>
    </div>

    <f:PageManager ID="PageManager1" runat="server" />
    <f:Form runat="server" ShowBorder="false" ShowHeader="false" ID="Form1">
        <Items>
            <f:ContentPanel runat="server" ID="sdfsdf" ShowBorder="false">
                <div style="width:100%;background: #f2f2f2;">
                    <span style="display: inline-block;font-size:16px;font-weight:bold;background:#fff;height: 38px;line-height: 38px;color: #171717;padding:0 20px;border-top: solid 2px #ea0900;">留言板</span>
                </div>
                <div style="width:100%;margin: 10px auto;">
                    <div>
                        <f:TextArea ID="txtSuggestion" runat="server" Width="1100px" Height="200px"></f:TextArea>
                    </div>
                    <div class="mycontactinfo" style="margin: 20px 0;">
                        <table border="0" cellspacing="0" cellpadding="10" style="width: 100%;">
                            <tr>
                                <td style="text-align: center;">姓名：</td>
                                <td>
                                    <f:TextBox ID="txtName" runat="server" Width="220px"></f:TextBox>
                                </td>
                                <td style="text-align: center;">联系方式：</td>
                                <td>
                                    <f:TextBox ID="txtMobileNo" runat="server" Width="220px"></f:TextBox>
                                </td>
                                <td style="text-align: center;">所属支部：</td>
                                <td>
                                    <f:TriggerBoxPicker runat="server" ID="ppBranch" Width="220px" EnableEdit="false" WindinsTitle="选择支部" WindinsHeight="450px" WindinsWidth="700px" WindinsUrl="../app/Share/Picker/BranchSinglePicker.aspx" Trigger1Icon="None">
                                    </f:TriggerBoxPicker>
                                </td>
                                <td colspan="2" style="text-align: center;">
                                    <asp:Button ID="btnSave" runat="server" Text="确定" CssClass="mybtn" OnClick="btnSave_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </f:ContentPanel>
        </Items>
    </f:Form>
    <f:Window ID="Window1" CloseAction="Hide" runat="server" IsModal="true" Title="选择党支部"
        Hidden="true" Target="Parent" EnableResize="true" EnableMaximize="true" EnableIFrame="true"
        IFrameUrl="about:blank" Width="700px" Height="500px">
    </f:Window>
    <f:HiddenField ID="hdBranchID" runat="server"></f:HiddenField>
    <style>
        .tabar_zzz {
            width: 100%;
            margin-top:20px;
            border: solid 1px #e8e8e8;
        }
        .tabar_zzz tbody tr td{
            font-size:14px;
            height: 48px;
            line-height: 48px;
        }
         .tabar_zzz tbody tr:nth-child(2n+1){
            background: #f7f7f7;
        }
    </style>
</asp:Content>
